package scenic.geom;

class RectangleDouble {
	public double x;
	public double y;
	public double width;
	public double height;
	
	static public RectangleDouble combine(RectangleDouble a, RectangleDouble b) {
		RectangleDouble r = new RectangleDouble();
		
		if(a.width == 0.0 || a.height == 0.0)
			return b;
		if(b.width == 0.0 || b.height == 0.0)
			return a;
		
		r.x = Math.min(a.x, b.x);
		r.y = Math.min(a.y, b.y);
		r.width = Math.max(a.x + a.width, b.x + b.width) - r.x;
		r.height = Math.max(a.y + a.height, b.y + b.height) - r.y;
		
		return r;
	}
}
